<template>
	<div class="code-config">
		<div class="code-config-title">
			创建一个 cn.publink.shb.application.service.common.service.ShbMatchRuleService 接口的实现类；重写match方法，根据自己业务需要进行编写代码。返回true表示条件满足，返回false表示条件不满足
		</div>
		<div class="code-config-content">
			<div class="code-config-content-title">
                <el-button type="text" @click="openCodeHelp">编码规范及使用帮助</el-button>
                <!-- <el-button >全屏编辑</el-button> -->
			</div>
            <action-codemirror :value.sync="state.currentNodeInfoFront.options.convertCode" v-if="state.trigger_code_gray"></action-codemirror>
		</div>
	</div>
</template>

<script>
import actionCodemirror from '@src/modules/connector/view/setting/components/workflow/components/drawers/actionCodemirror.vue';
import { condition } from '@src/modules/connector/util/sampleCode.ts'
import state from '@src/modules/trigger/view/setting/util/state.js'

export default {
	name: 'CodeConfig',
    computed: {
        state() {
            return state;
        },
    },
	created() {
		if (!state.currentNodeInfoFront?.options?.convertCode) {
			this.$set(state.currentNodeInfoFront, 'options', {
				...state.currentNodeInfoFront?.options,
				convertType: "code",
				convertCode: condition,
			});
		}
	},
    components: {
        actionCodemirror,
    },
    methods: {
        // 打开编码规范及使用帮助
        openCodeHelp() {
            window.open('https://doc.shb.ltd/shb_xoqazk/ia4qctp2ly559d1m/gre7yumc5sz4ewod/dklg7gkm64cya8l4/ox8c8k8i3hp1g6do.html');
        },
    }
}
</script>

<style scoped lang="scss">
.code-config {
	&-content {
		height: calc(100vh - 356px);
		::v-deep .action-app-codemirror {
			height: inherit;
		}
		&-title {
			display: flex;
			justify-content: space-between;
			align-items: center;
			height: 24px;
			margin: 8px 0;
		}
	}
}
</style>
